package com.ssh.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ssh.dao.StudentDAO;
import com.ssh.model.Student;

@Component("studentService")
public class StudentService
{
    private StudentDAO stuDao;
    
    public Student loadById(int id) {
        Student stu = stuDao.getStudentById( id );
        return stu;
    }
    
    public void add(Student stu) {
        stuDao.save( stu );
    }

    @Resource(name="studentDao")
    public void setStuDao(StudentDAO stuDao)
    {
        this.stuDao = stuDao;
    }

    public StudentDAO getStuDao()
    {
        return stuDao;
    }
}
